<template>
  <header class="app-header">
    <div class="header-container">
      <!-- Logo和网站名称 -->
      <div class="header-left">
        <router-link to="/" class="logo-wrapper">
          <div class="logo">
              <div class="logo-icon">
                <img src="@/assets/logo/logo.svg" alt="Logo" class="logo-image" />
              </div>
            <div class="logo-text">
              <h1>GovernTalk</h1>
              <p class="logo-subtitle">公考交流平台</p>
            </div>
          </div>
        </router-link>
        
        <!-- 主导航 -->
        <nav class="main-nav">
          <div class="nav-group">
            <router-link to="/" class="nav-item" :class="{ active: $route.path === '/' }">
              <el-icon class="nav-icon"><House /></el-icon>
              <span class="nav-label">首页</span>
              <span class="nav-indicator"></span>
            </router-link>
          </div>
          <div class="nav-group">
            <router-link to="/forum" class="nav-item" :class="{ active: $route.path.startsWith('/forum') }">
              <el-icon class="nav-icon"><Message /></el-icon>
              <span class="nav-label">论坛</span>
              <span class="nav-indicator"></span>
            </router-link>
          </div>
          <div class="nav-group">
            <router-link to="/search-question" class="nav-item" :class="{ active: $route.path.startsWith('/search-question') }">
              <el-icon class="nav-icon"><Document /></el-icon>
              <span class="nav-label">题库</span>
              <span class="nav-indicator"></span>
            </router-link>
          </div>
          <div class="nav-group">
            <router-link to="/study-groups" class="nav-item" :class="{ active: $route.path.startsWith('/study-groups') }">
              <el-icon class="nav-icon"><UserFilled /></el-icon>
              <span class="nav-label">学习小组</span>
              <span class="nav-indicator"></span>
            </router-link>
          </div>
          <div class="nav-group">
            <router-link to="/resources" class="nav-item" :class="{ active: $route.path.startsWith('/resources') }">
              <el-icon class="nav-icon"><FolderOpened /></el-icon>
              <span class="nav-label">学习资源</span>
              <span class="nav-indicator"></span>
            </router-link>
          </div>
          <div class="nav-group">
            <router-link to="/ai-solution" class="nav-item" :class="{ active: $route.path.startsWith('/ai-solution') }">
              <el-icon class="nav-icon"><Cpu /></el-icon>
              <span class="nav-label">智能解答</span>
              <span class="nav-indicator"></span>
            </router-link>
          </div>
        </nav>
      </div>
      
      <!-- 右侧功能区 -->
      <div class="header-right">
        <!-- 搜索框 -->
        <div class="search-wrapper">
          <el-input
            v-model="searchKeyword"
            placeholder="搜索题库、论坛、资源..."
            size="default"
            class="search-input"
            prefix-icon="Search"
            @keyup.enter="handleSearch"
          />
        </div>
        
        <!-- 快捷功能 -->
        <div class="quick-actions">
          <!-- 通知中心 -->
          <div class="action-item">
            <el-tooltip content="通知中心" placement="bottom">
              <el-badge :value="notificationCount" is-dot class="notification-badge">
                <el-button
                  icon="Bell"
                  size="default"
                  circle
                  @click="openNotificationCenter"
                  class="action-btn"
                  :class="{ 'btn-hover': showNotificationBtnHover }"
                  @mouseenter="showNotificationBtnHover = true"
                  @mouseleave="showNotificationBtnHover = false"
                />
              </el-badge>
            </el-tooltip>
          </div>
          
          <!-- 主题切换 -->
          <div class="action-item">
            <el-tooltip content="切换主题" placement="bottom">
              <el-button
                :icon="isDarkMode ? 'Sun' : 'Moon'"
                size="default"
                circle
                class="action-btn"
                @click="toggleTheme"
              />
            </el-tooltip>
          </div>
        </div>
        
        <!-- 用户菜单 -->
        <div v-if="isAuthenticated && userInfo && userInfo.username" class="user-menu">
          <el-dropdown
            trigger="hover"
            @command="handleUserMenuCommand"
            :show-timeout="200"
            :hide-timeout="300"
          >
            <div class="user-info-wrapper">
              <div class="user-avatar-container">
                <img 
                  :src="userInfo.avatar || defaultAvatarUrl" 
                  alt="用户头像" 
                  class="user-avatar"
                  @error="handleAvatarError"
                />
                <div class="user-avatar-badge" v-if="(userInfo as any)?.isVip">
                  <el-icon class="vip-icon"><Star /></el-icon>
                </div>
              </div>
              <div class="user-details">
                <span class="user-name">{{ userInfo.username }}</span>
                <span class="user-level" v-if="(userInfo as any)?.level">Lv.{{ (userInfo as any).level }}</span>
              </div>
              <el-icon class="arrow-icon"><ArrowDown /></el-icon>
            </div>
            <template #dropdown>
              <el-dropdown-menu class="custom-dropdown-menu">
                <el-dropdown-item command="profile" class="dropdown-item">
                  <el-icon><User /></el-icon>
                  <span>个人中心</span>
                </el-dropdown-item>
                <el-dropdown-item command="collections" class="dropdown-item">
                  <el-icon><Star /></el-icon>
                  <span>我的收藏</span>
                </el-dropdown-item>
                <el-dropdown-item command="history" class="dropdown-item">
                  <el-icon><Clock /></el-icon>
                  <span>浏览历史</span>
                </el-dropdown-item>
                <el-divider class="dropdown-divider" />
                <el-dropdown-item v-if="isAdmin" command="admin" class="dropdown-item">
                  <el-icon><Setting /></el-icon>
                  <span>管理中心</span>
                </el-dropdown-item>
                <el-dropdown-item command="logout" divided class="dropdown-item">
                  <el-icon><ArrowDown /></el-icon>
                  <span>退出登录</span>
                </el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
        
        <!-- 登录/注册按钮 -->
        <div v-else class="auth-buttons">
          <router-link to="/login">
            <el-button size="default" class="login-btn">登录</el-button>
          </router-link>
          <router-link to="/register">
            <el-button size="default" type="primary" class="register-btn" style="background-color: #409EFF; border-color: #409EFF;">注册</el-button>
          </router-link>
        </div>
      </div>
    </div>
    
    <!-- 通知中心面板 -->
    <transition name="notification-slide">
      <div v-if="showNotificationCenter" class="notification-panel" ref="notificationPanel">
        <div class="notification-header">
          <h3>通知中心</h3>
          <el-button size="small" text @click="markAllAsRead" class="mark-all-btn">全部已读</el-button>
        </div>
        <div class="notification-tabs">
          <el-tabs v-model="activeTab" type="card" size="small" class="notification-tabs-container">
            <el-tab-pane label="全部" name="all" />
            <el-tab-pane label="系统" name="system" />
            <el-tab-pane label="互动" name="interaction" />
          </el-tabs>
        </div>
        <div class="notification-list">
          <div v-if="filteredNotifications.length === 0" class="no-notifications">
            <el-empty description="暂无通知" :image-size="120" />
          </div>
          <div v-else>
            <div 
              v-for="notification in filteredNotifications" 
              :key="notification.id" 
              class="notification-item"
              :class="{ 'unread': !notification.isRead }"
              @click="markAsRead(notification.id)"
            >
              <div class="notification-icon">
                <el-icon v-if="notification.type === 'system'" class="system-icon"><Message /></el-icon>
                <el-icon v-else class="interaction-icon"><Comment /></el-icon>
              </div>
              <div class="notification-content">
                <div class="notification-title">{{ notification.title }}</div>
                <div class="notification-text">{{ notification.content }}</div>
                <div class="notification-time">{{ notification.time }}</div>
              </div>
              <div v-if="!notification.isRead" class="notification-unread-dot"></div>
            </div>
          </div>
        </div>
      </div>
    </transition>
  </header>
</template>

<script setup lang="ts">
import { ref, onMounted, onUnmounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import { defineProps } from 'vue'
import { ElMessage, ElMessageBox, ElEmpty, ElTabs, ElTabPane } from 'element-plus'
import {
  House, Message, Document, UserFilled, FolderOpened, Cpu,
  User, Star, Clock, Setting, ArrowDown, Comment
} from '@element-plus/icons-vue'
import { useUserStore } from '@/store/user'

const defaultAvatarUrl = '/src/assets/avatar/user-avatar-default.svg'

// 使用用户store
const userStore = useUserStore()

// Props
interface Props {
  userInfo?: any
  isAdmin?: boolean
}

defineProps<Props>()
// const emit = defineEmits<{
//   logout: []
// }>()

// 计算属性：用户信息
const userInfo = computed(() => userStore.user)
const isAuthenticated = computed(() => userStore.isAuthenticated)
const isAdmin = computed(() => userStore.isAdmin)

// 路由
const router = useRouter()

// 响应式数据
const searchKeyword = ref('')
const showNotificationCenter = ref(false)
const notificationPanel = ref<HTMLElement>()
const notificationCount = ref(3) // 模拟未读通知数量
const showNotificationBtnHover = ref(false)
const isDarkMode = ref(false)
const activeTab = ref('all')

const notifications = ref([
  {
    id: 1,
    title: '新的评论回复',
    content: '用户"公考达人"回复了你的评论：这个解题思路太棒了，学到了！',
    time: '10分钟前',
    isRead: false,
    type: 'interaction'
  },
  {
    id: 2,
    title: '系统通知',
    content: '论坛新增了200道面试真题，快来查看吧！',
    time: '1小时前',
    isRead: false,
    type: 'system'
  },
  {
    id: 3,
    title: '小组活动提醒',
    content: '你加入的学习小组"行测高分"将在明天晚上8点举行线上讨论',
    time: '昨天',
    isRead: false,
    type: 'system'
  }
])

// 计算属性：过滤通知
const filteredNotifications = computed(() => {
  if (activeTab.value === 'all') {
    return notifications.value
  }
  return notifications.value.filter(n => n.type === activeTab.value)
})

// 处理搜索
const handleSearch = () => {
  if (searchKeyword.value.trim()) {
    router.push({ path: '/search', query: { keyword: searchKeyword.value } })
    searchKeyword.value = ''
  } else {
    ElMessage.warning('请输入搜索内容')
  }
}

// 打开通知中心
const openNotificationCenter = () => {
  showNotificationCenter.value = !showNotificationCenter.value
}

// 关闭通知中心
const closeNotificationCenter = () => {
  showNotificationCenter.value = false
}

// 标记全部已读
const markAllAsRead = () => {
  notifications.value.forEach(notification => {
    notification.isRead = true
  })
  notificationCount.value = 0
  ElMessage.success('已标记全部通知为已读')
}

// 标记单个已读
const markAsRead = (notificationId: number) => {
  const notification = notifications.value.find(n => n.id === notificationId)
  if (notification && !notification.isRead) {
    notification.isRead = true
    notificationCount.value = notificationCount.value - 1
    ElMessage.success('已标记为已读')
  }
}

// 切换主题
const toggleTheme = () => {
  isDarkMode.value = !isDarkMode.value
  document.body.classList.toggle('dark-mode', isDarkMode.value)
  ElMessage.info(`已切换到${isDarkMode.value ? '深色' : '浅色'}主题`)
}

// 处理头像加载错误
const handleAvatarError = (event: Event) => {
  const img = event.target as HTMLImageElement
  if (img) {
    img.src = defaultAvatarUrl
  }
}

// 处理用户菜单命令
const handleUserMenuCommand = (command: string) => {
  switch (command) {
    case 'profile':
      router.push('/profile')
      break
    case 'collections':
      router.push('/collections')
      break
    case 'history':
      router.push('/history')
      break
    case 'admin':
      router.push('/admin')
      break
    case 'logout':
      ElMessageBox.confirm(
        '确定要退出登录吗？',
        '确认退出',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }
      )
        .then(() => {
          userStore.logout()
          ElMessage.success('已退出登录')
          router.push('/login')
        })
        .catch(() => {
          // 用户取消操作
        })
      break
  }
}

// 点击外部关闭通知中心
const handleClickOutside = (event: MouseEvent) => {
  if (notificationPanel.value && !notificationPanel.value.contains(event.target as Node)) {
    closeNotificationCenter()
  }
}

// 生命周期
onMounted(() => {
  document.addEventListener('click', handleClickOutside)
})

onUnmounted(() => {
  document.removeEventListener('click', handleClickOutside)
})
</script>

<style scoped>
/* 主题变量 */
:root {
  --primary-color: #409eff;
  --primary-hover: #66b1ff;
  --primary-active: #3a8ee6;
  --success-color: #67c23a;
  --warning-color: #e6a23c;
  --danger-color: #f56c6c;
  --text-primary: #303133;
  --text-regular: #606266;
  --text-secondary: #909399;
  --text-placeholder: #c0c4cc;
  --border-color: #e4e7ed;
  --bg-color: #f5f7fa;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-regular: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.2);
  --border-radius: 8px;
}

/* 深色主题变量 */
.dark-mode {
  --primary-color: #66b1ff;
  --primary-hover: #8cc8ff;
  --primary-active: #409eff;
  --text-primary: #e5e5e5;
  --text-regular: #c0c4cc;
  --text-secondary: #909399;
  --bg-color: #1a1a1a;
  --border-color: #333;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-regular: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
  box-shadow: var(--shadow-light);
  z-index: 1000;
  transition: all 0.3s ease;
}

.dark-mode .app-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid #333;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 30px;
  max-width: 1600px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 48px;
}

/* Logo样式 */
.logo-wrapper {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-active) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  transition: all 0.3s ease;
}

.logo-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
}

.logo-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.icon-large {
  font-size: 24px;
  color: #fff;
}

.logo-text h1 {
  margin: 0;
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

.logo-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 导航样式 */
.main-nav {
  display: flex;
  gap: 1px;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark-mode .main-nav {
  background-color: rgba(40, 44, 52, 0.7);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-group {
  position: relative;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: 20px;
  color: var(--text-regular);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  font-size: 14px;
  min-width: 80px;
}

.nav-item:hover {
  background-color: rgba(64, 158, 255, 0.1);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.nav-item.active {
  background-color: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4);
}

.nav-icon {
  font-size: 18px;
}

.nav-label {
  font-weight: 500;
}

.nav-indicator {
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  background-color: currentColor;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-item.active .nav-indicator {
  opacity: 1;
}

/* 右侧功能区 */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 搜索框 */
.search-wrapper {
  position: relative;
  width: 280px;
  transition: width 0.3s ease;
}

.search-wrapper:hover {
  width: 320px;
}

.search-input {
  border-radius: 24px;
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

/* 快捷操作 */
.quick-actions {
  display: flex;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark-mode .quick-actions {
  background-color: rgba(40, 44, 52, 0.7);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.action-item {
  position: relative;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background-color: var(--primary-color);
  color: #fff;
  transform: scale(1.1);
}

.btn-hover {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(64, 158, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(64, 158, 255, 0);
  }
}

.notification-badge .el-badge__content {
  background-color: var(--danger-color);
  box-shadow: 0 2px 8px rgba(245, 108, 108, 0.4);
}

/* 用户菜单 */
.user-menu {
  position: relative;
}

.user-info-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 24px;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.dark-mode .user-info-wrapper {
  background-color: rgba(40, 44, 52, 0.7);
  border-color: #303642;
}

.user-info-wrapper:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
  transform: translateY(-1px);
}

.user-avatar-container {
  position: relative;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  object-fit: cover;
  transition: all 0.3s ease;
}

.user-avatar-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--warning-color);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark-mode .user-avatar-badge {
  border-color: #1f2127;
}

.vip-icon {
  font-size: 10px;
  color: #fff;
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.user-level {
  font-size: 11px;
  color: var(--primary-color);
  background-color: rgba(64, 158, 255, 0.1);
  padding: 1px 6px;
  border-radius: 10px;
}

.arrow-icon {
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.el-dropdown-open .arrow-icon {
  transform: rotate(180deg);
}

/* 自定义下拉菜单 */
.custom-dropdown-menu {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: var(--shadow-regular);
  overflow: hidden;
}

.dropdown-item {
  transition: all 0.3s ease;
  font-size: 14px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background-color: rgba(64, 158, 255, 0.1);
  color: var(--primary-color);
}

.dropdown-divider {
  margin: 0;
  background-color: var(--border-color);
}

/* 登录/注册按钮 */
.auth-buttons {
  display: flex;
  gap: 12px;
}

.login-btn {
  border-radius: 24px;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background-color: transparent;
  transition: all 0.3s ease;
  min-width: 80px;
}

.login-btn:hover {
  background-color: rgba(64, 158, 255, 0.1);
  transform: translateY(-1px);
}

.register-btn {
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-active) 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  transition: all 0.3s ease;
  min-width: 80px;
}

.register-btn:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
  box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
  transform: translateY(-1px);
}

/* 通知中心面板 */
.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 20px;
  width: 420px;
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-deep);
  overflow: hidden;
  z-index: 1001;
  border: 1px solid var(--border-color);
}

.dark-mode .notification-panel {
  background-color: #1f2127;
  border-color: #303642;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: #f8f9fa;
}

.dark-mode .notification-header {
  background-color: #2c3036;
  border-bottom-color: #303642;
}

.notification-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.mark-all-btn {
  color: var(--primary-color);
  transition: color 0.3s ease;
}

.mark-all-btn:hover {
  color: var(--primary-hover);
}

/* 通知标签页 */
.notification-tabs {
  border-bottom: 1px solid var(--border-color);
}

.notification-tabs-container {
  .el-tabs__nav {
    margin: 0;
    padding-left: 10px;
  }
  
  .el-tabs__item {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-regular);
    transition: all 0.3s ease;
  }
  
  .el-tabs__item:hover {
    color: var(--primary-color);
  }
  
  .el-tabs__item.is-active {
    color: var(--primary-color);
    font-weight: 500;
  }
  
  .el-tabs__active-bar {
    background-color: var(--primary-color);
    height: 2px;
  }
}

.notification-list {
  max-height: 480px;
  overflow-y: auto;
}

.no-notifications {
  padding: 60px 20px;
  text-align: center;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.notification-item:hover {
  background-color: #f8f9fa;
}

.dark-mode .notification-item:hover {
  background-color: #2c3036;
}

.notification-item.unread {
  background-color: #e6f7ff;
}

.dark-mode .notification-item.unread {
  background-color: #2c3036;
  border-left: 3px solid var(--primary-color);
}

.notification-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.dark-mode .notification-icon {
  background-color: #303642;
}

.system-icon {
  color: var(--primary-color);
}

.interaction-icon {
  color: var(--success-color);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notification-text {
  font-size: 13px;
  color: var(--text-regular);
  margin-bottom: 6px;
  line-height: 1.4;
}

.notification-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.notification-unread-dot {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger-color);
  box-shadow: 0 2px 4px rgba(245, 108, 108, 0.3);
}

/* 动画效果 */
.notification-slide-enter-active,
.notification-slide-leave-active {
  transition: all 0.3s ease;
}

.notification-slide-enter-from,
.notification-slide-leave-to {
  opacity: 0;
  transform: translateY(-10px);
}

/* 滚动条样式 */
.notification-list::-webkit-scrollbar {
  width: 6px;
}

.notification-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dark-mode .notification-list::-webkit-scrollbar-track {
  background: #2c3036;
}

.notification-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.dark-mode .notification-list::-webkit-scrollbar-thumb {
  background: #4a505c;
}

.notification-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.dark-mode .notification-list::-webkit-scrollbar-thumb:hover {
  background: #5a606c;
}

/* 响应式布局 */
@media (max-width: 1400px) {
  .header-container {
    padding: 0 24px;
  }
  
  .header-left {
    gap: 36px;
  }
  
  .search-wrapper {
    width: 240px;
  }
  
  .search-wrapper:hover {
    width: 280px;
  }
}

@media (max-width: 1200px) {
  .app-header {
    height: 64px;
  }
  
  .header-container {
    padding: 0 20px;
  }
  
  .header-left {
    gap: 24px;
  }
  
  .logo {
    gap: 8px;
  }
  
  .logo-icon {
    width: 40px;
    height: 40px;
  }
  
  .logo-text h1 {
    font-size: 20px;
  }
  
  .logo-subtitle {
    display: none;
  }
  
  .nav-item {
    padding: 8px 12px;
    min-width: 70px;
    font-size: 13px;
  }
  
  .search-wrapper {
    width: 200px;
  }
  
  .search-wrapper:hover {
    width: 240px;
  }
  
  .notification-panel {
    width: 380px;
  }
}

@media (max-width: 992px) {
  .main-nav {
    display: none;
  }
  
  .search-wrapper {
    width: 180px;
  }
  
  .search-wrapper:hover {
    width: 220px;
  }
  
  .user-details {
    display: none;
  }
  
  .notification-panel {
    width: 340px;
    right: 10px;
  }
}

@media (max-width: 768px) {
  .app-header {
    height: 56px;
  }
  
  .header-container {
    padding: 0 16px;
  }
  
  .header-left {
    gap: 16px;
  }
  
  .logo-icon {
    width: 36px;
    height: 36px;
  }
  
  .logo-text h1 {
    font-size: 18px;
  }
  
  .search-wrapper {
    display: none;
  }
  
  .quick-actions {
    padding: 2px;
  }
  
  .action-btn {
    width: 32px;
    height: 32px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .notification-panel {
    width: calc(100vw - 32px);
    right: 16px;
    left: 16px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 12px;
  }
  
  .header-left {
    gap: 12px;
  }
  
  .logo-text h1 {
    font-size: 16px;
  }
  
  .auth-buttons {
    gap: 8px;
  }
  
  .login-btn,
  .register-btn {
    min-width: 60px;
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .notification-panel {
    width: calc(100vw - 24px);
    right: 12px;
    left: 12px;
  }
}
</style>